package com.example.demo.dao;

import com.example.demo.model.UserInfo;
import com.example.demo.model.vo.UserInfoVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface UserMapper {
    /**
     * 在用户表中插入数据
     * @param userInfo
     * @return
     */
    @Insert("insert into userInfo(username,password) values (#{username},#{password})")
    int register(UserInfo userInfo);

    /**
     * 通过用户名查询用户
     * @param username
     * @return
     */
    @Select("select * from userInfo where username=#{username}")
    UserInfo getUserByName(@Param("username") String username);

    @Select("select * from userInfo where id = #{uid}")
    UserInfoVo getUserByUid(@Param("uid")int uid);
}
